# Contributor: kpcyrd <git@rxv.cc>
# Maintainer: kpcyrd <git@rxv.cc>
pkgname=acmetool
pkgver=0.0.67
pkgrel=7
pkgdesc="An easy-to-use command line tool for automatically acquiring certificates from ACME servers (such as Let's Encrypt)"
url="https://github.com/hlandau/acme"
arch="all"
license="MIT"
makedepends="go libcap-dev"
subpackages="$pkgname-doc"
# no test suite available
options="!check net"
source="$pkgname-$pkgver.tar.gz::https://github.com/hlandau/acme/archive/v$pkgver.tar.gz
	go.mod
	go.sum
	"

export GOPATH="$srcdir/go"
export GOCACHE="$srcdir/go-build"
export GOTMPDIR="$srcdir"

export GOFLAGS="$GOFLAGS -modcacherw"

prepare() {
	default_prepare

	cp "$srcdir"/go.mod "$srcdir"/go.sum "$builddir"/
}

build() {
	go build -v -ldflags "-s -w -X github.com/hlandau/acme/hooks.DefaultPath=/etc/acme/hooks" \
		./cmd/acmetool/...
}

package() {
	install -Dm 755 acmetool "$pkgdir/usr/bin/acmetool"

	install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README"
	install -Dm644 _doc/* -t "$pkgdir/usr/share/doc/$pkgname/"
}

sha512sums="
b0c3013167ceee6c1e577cf1678c256ffed243e8aa5038d86836e625a7c484fd5ca2bb79feb1cae981afc49a6e1635b62b23e58d11a86cc9c1e5012d9e0a638a  acmetool-0.0.67.tar.gz
69b85068284bcb6960d68b4a23e7703fdf8bd39ff986b1e73ce1846c4dd0ec16a2bf2d4cb25dc3431d48cde37eb78cd4e49b22e51cc6434a6e242acb8b7a67db  go.mod
50b020680e39b5b43df6470367d730c8827797f1426a94763ca6810dfc9a707d0e0b06f0e210c3c6da2cc10c0ed11754abebe2e235dc859bd2bb9e6e9544fd84  go.sum
"
